import 'package:bruno/bruno.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:jinke/utils/colors_util.dart';
import 'package:jinke/utils/component/page_state/widgets/empty.dart';

import '../../../utils/httputils/api.dart';
import '../../../utils/httputils/resultdata.dart';

/// @Author : 王亚东

/// @Time : On 2022/9/15 16:39

class MakeReportPage extends StatelessWidget {
  MakeReportPage(this.reportDate,this.specialType);
  String reportDate,specialType;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: BackButton(color: Colors.white,),
        backgroundColor: ColorsUtil.blue,
        title: Text('日报生成',style: TextStyle(color: Colors.white,fontSize: 17.r),),
        centerTitle: true,

      ),
      body: Column(
        children: [
          EmptyView(title: '今日工作日报暂未生成',),
          GestureDetector(
            onTap: (){
              BrnDialogManager.showConfirmDialog(
                Get.context!,
                // title: "是否生成",
                cancel: '取消',
                confirm: '生成',
                message: "是否生成报告？",
                onConfirm: () async{
                  Get.back();
                  ResultData response = await Api.generateGatherReport({'reportDate': reportDate, 'specialType': specialType});
                  if(response.isSuccess) {

                    Get.back(result: true);
                  }
                },
                onCancel: () {
                  Get.back();
                },
              );
            },
            child: Container(
              height: 45.r,
              margin: EdgeInsets.only(left: 30.r,right: 30.r),
              decoration: BoxDecoration(
                  color: ColorsUtil.blue,
                  borderRadius: BorderRadius.circular(30.r)
              ),
              child: const Center(
                child: Text('一键生成',style: TextStyle(color: Colors.white),),
              ),
            ),
          )
        ],
      ),
    );
  }
}


 
